<template>
  <div id="app">
    <!-- 输入框 -->
    <div class="inputText">
      <input type="text" placeholder="请输入商品，商家" @click="$router.push('/sousuo')">
    </div>
    <!-- 轮播图 -->
    <div class="imgbox">
      <van-swipe class="my-swipe" :autoplay="1000" indicator-color="blue" >
              <van-swipe-item  v-for="(item,index) in dy" :key="index"> <img :src="item.bannerUrl" alt=""> </van-swipe-item>
      </van-swipe>
    </div>
   <div class="option">
     <h2>猜你喜欢</h2>   
     <div class="bigbox">
       <div :class ="{active:currentIndex == index}" @click="fun(index)" class="name" v-for="(item,index) in str" :key="index"> {{item}} </div>
     </div>
     <div class="hei">
        <span class="biao" v-for="(item,index) in stt" :key="index"> {{item}} </span>
     </div>
       <!-- 店铺列表 -->
     <div class="cai">
       <div class="caidan" @click="todate(item)"  v-for="(item,index) in arr" :key="index">
        <div class="imgbox">
            <img :src="item.picUrl" alt="" class="tu">
        </div>
        <div class="jieshao">
            <h3 class="hh"> {{item.name}} </h3>
            <span class="bin"> ★ {{item.wmPoiScore/10}} </span><span class="fenzhong">{{item.monthSalesTip}}</span>
            <div class="ss">
                <span class="chao">{{item.minPriceTip}} {{item.shippingFeeTip}}</span><span> {{item.deliveryTimeTip
                  }} {{item.distance}}</span>
            </div>
            <div class="manjian">
                <span class="jian"> {{item.discounts2[0].info}}</span>
            </div>

        </div>
       </div>
    </div>
     </div>

  </div>
</template>

<script>
import {shop_list} from '../../utils/api'
import {banner_list} from '../../utils/api'
  import { Form } from 'vant'
export default {
      data(){
        return{
            str:["综合排序","距离最近","销量最高","筛选"],
            
            stt:["年货节热卖","津贴联盟","满减优惠","品质联盟"],
            currentIndex:0,
            con:0,
            arr:[],   
            dy:[],   
        }
    },
    mounted(){
      shop_list().then((res)=>{
        this.arr=res.data.list;    
        // console.log(res.data);          
      });
      //轮播接口
      banner_list().then((res)=>{
        this.dy = res.data.list;
        // console.log(res.data.list);
        
      })
    },
    methods:{
      fun(index){
        this.currentIndex = index;
      },
      todate(item){//跳到详情页
      this.$router.push('/date/'+item.mtWmPoiId);
      }
    }
}
</script>

<style lang="scss" scoped>
*{
  margin: 0;padding: 0;
}

.imgbox{
    margin: 6px auto;
    width: 100%;
    height: 150px;
    border-radius: 10px;
    padding: 10px;
    box-sizing: border-box;
}
.imgbox img{
    width: 100%;
    height:150px;
    border-radius: 10px;
}
.inputText{
  width: 100%;
  height: 100px;
  background-color: rgb(64, 134, 226);
  position: relative;
}
.inputText input{
  width: 95%;
  height: 40px;
  border-radius: 20px;
  border: none;
  text-align: center;
  box-sizing: border-box;
  position: absolute;
  outline: none;
  top: 29px;
  left: 9px;
}
.option h2{
    margin: 16px 0px 10px 10px;
}
.option .bigbox{
    display: flex;
    justify-content: space-around;
}
.option .bigbox .name{
    font-size: 18px;
    font-weight: 500;
}
.option .hei{
    display: flex;
    justify-content: space-around;
    margin: 13px 0px;
}
.option .hei span{
    display: block;
    width: 23%;
    height: 30px;
    background-color: #eeecec;
    border-radius: 5px;
    text-align: center;
    line-height: 30px;
}
.option>.bigbox>.active{
    font-weight: 800;
    font-size: 18px;
}
.caidan{
    display: flex;
    justify-content: space-between;
}
.caidan .imgbox{
    width: 120px;
    height: 150px;
}
.caidan .imgbox .tu{
    width: 120px;
    height: 120px;
}
.caidan .jieshao{
    width: 300px;
    height: 130px;
    padding: 0 20px;
}
.caidan .jieshao h3{
    font-size: 16px;
}
.caidan .jieshao .ss .chao{
    width: 40px;
    height: 10px;
    // background-color: rgba($color: #f0601d, $alpha: 0.5);
    margin: 5px 5px;
}
.caidan .jieshao .manjian span{
    border: solid 1px red;
    color: red;
    font-size: 12px;
    margin:5px 5px;
}
.cai{
  margin-bottom: 40px;
}

</style>